Skip to content

fix: require publish permission to manage scheduled actions - #239

Merged
TMSchipper merged 4 commits into
masterfrom
bugfix/212-restrict-plugin-users-without-permission
Nov 25, 2026
Merged

TMSchipper merged 4 commits into
masterfrom
bugfix/212-restrict-plugin-users-without-permission

Conversation

@TMSchipper

@TMSchipper TMSchipper commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #212

Problem

The admin routes of the plugin (/publisher/actions) were open to every authenticated admin user. A user whose role may create or edit entries but not publish them could still set a publish or unpublish date in the side panel, and the plugin would then publish or unpublish the entry at that time. That bypassed the Content Manager Publish permission.

Solution

The admin routes now follow the user's Content Manager permissions on the content type the action targets:

  • POST / PUT / DELETE /actions: new route policy plugin::publisher.can-manage-action. Only lets the request through when the user has the Publish permission (which also covers unpublish) on the target, including its conditions (e.g. "is creator") and the locale the action runs in. Otherwise it returns a 403 with a clear message, which the admin shows as a notification.
    • PUT checks both the current target and the updated one, so an existing action can't be moved to content the user may not publish. A field sent as null (e.g. locale: null) is treated as an actual change.
    • DELETE still works for actions whose entry has been deleted in the meantime.
  • GET /actions: new route middleware plugin::publisher.limit-to-readable-content-types. Only returns actions of content types the user can read. Existing filters are combined with it, not replaced.
  • The logic lives in the new permissionService, which uses Strapi's Content Manager permission-checker and populate-builder to evaluate permissions the same way the Content Manager does when publishing.

The Content API routes (/api/publisher/actions) are unchanged. Access to them is still managed by Users & Permissions or API token permissions.

Testing

  • New smoke test tests/permissions.js (runs in CI):
    • a user without publish permission gets a 403 on create/update/delete and an empty or filtered list;
    • a non-super-admin who may publish Articles can manage Article actions but not Homepage actions.
  • The smoke test is split into playground/scripts/smoke-test/ (node:test, Strapi starts once) with shared helpers in lib/.
  • The playground now has realistic content (Article with relations, components and a dynamic zone; Homepage; i18n Page in en + nl; Author; Category), so scheduling and locale-restricted permissions can be tested by hand.

Manual test

  1. yarn develop, then create a role with Article create/read/update permissions but without Publish, and a user with that role.
  2. Log in as that user and try to schedule a publish date on an article. You get a 403 notification and nothing is scheduled.
  3. Give the role the Publish permission. Scheduling now works.

Docs

  • README: new Permissions section.
  • CLAUDE.md: updated for the new API restriction, smoke test layout and playground.

Every admin user could reach the admin routes for publisher actions. So users
without the Content Manager publish permission could still schedule, change
or delete (un)publish dates (#212).

closes #212
fix: don't let a null field in an action update bypass the permission check (#212)

Make the playground closer to a real project, so scheduling is tested
against relations, components, dynamic zones and localized content
instead of an article with only a title and body
@TMSchipper
TMSchipper force-pushed the bugfix/212-restrict-plugin-users-without-permission branch from d570f84 to 5c0832e Compare November 14, 2026 13:20
@TMSchipper
TMSchipper marked this pull request as ready for review November 16, 2026 09:18
@TMSchipper
TMSchipper merged commit 135e098 into master Nov 25, 2026
4 checks passed
@TMSchipper
TMSchipper deleted the bugfix/212-restrict-plugin-users-without-permission branch November 25, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restrict plugin to users without "Publish" permissions

1 participant